pub fn take_while_test(){
    println!("--------take_while_test--------");
    let message = "To: jimb\r\n\
                        From: superego <editor@oreilly.com>\r\n\
                        \r\n\
                        Did you get any writing done today?\r\n\
                        When will you stop wasting time plotting fractals?\r\n";
    for header in message.lines().take_while(|l|!l.is_empty()){
        println!("{}", header);
    }
}

pub fn take_while(){
    println!("--------take_while--------");
    let message = "To: jimb\r\n\
                        From: superego <editor@oreilly.com>\r\n\
                        \r\n\
                        Did you get any writing done today?\r\n\
                        When will you stop wasting time plotting fractals?\r\n";
    // 获取所有行总数
    let count = message.lines().count();
    // 最后一行不显示
    for line in message.lines().take(count-1) {
        println!("{}", line);
    }
    // 显示所有
    message.lines().for_each(|line|println!("{}",line))
}